import sys
sys.path.append('/data/zhuoran/code/cognlp')

from cognlp.utils.util import save_json, load_json
from cognlp import *
import json
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from torch.utils.data import DataLoader, RandomSampler
from cognlp.io.loader.rex import TrexReLoader
from cognlp.io.processor.rex import REXProcessor
from cognlp.models.re.bert_re import Bert4Re, Bert4ReParallel
from cognlp.core.metrics import AccuracyMetric
from cognlp.core.trainer import Trainer
from cognlp.core.dataset import RexDataset

data = load_json('../data/re/trexfull/data/result.json')
processor = REXProcessor(path='../data/re/trexfull/data')
processor.process_raw_data(data, path='../data/re/trexfull/data/train.json')
# device = torch.device('cuda')
# loader = TrexReLoader()
# data = loader.load_all('../data/re/trex/data')
# processor = REXProcessor(label_list=loader.get_labels(), path='../data/re/trex/data')
# train_data = processor.get_raw_data(data, '../data/re/trex/data/data.json')
# print(1)
